﻿Public Class FLogin

    Dim sql As New Mysql
    Public id_usr As Integer


    Private Sub txtClave_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtClave.KeyPress
        If Asc(e.KeyChar) = 13 Then
            Dim Dt As System.Data.DataTable
            Dt = sql.LEER("SELECT * From usuarios i Where (i.login = '" & txtUser.Text & "') AND (i.clave ='" & txtClave.Text & "')")
            If Dt.Rows.Count <> 0 Then
                id_usuario = Dt.Rows(0).Item("id_usuario")
                id_actividad = Dt.Rows(0).Item("id_actividad")
                id_area = Dt.Rows(0).Item("id_area")
                id_subarea = Dt.Rows(0).Item("id_subarea")

                If id_area = 1 Then
                    Me.Hide()
                    FPrincipal.ShowDialog()
                Else
                    Me.Hide()
                    FABM_Tareas.ShowDialog()
                End If

                Me.Close()
            Else
                MsgBox("Verifique Usuario y/o contraseña")
            End If
        End If
    End Sub


    Private Sub txtUser_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtUser.KeyPress
        If Asc(e.KeyChar) = 13 Then
            txtClave.Focus()
        End If
    End Sub



    Private Sub txtUser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUser.TextChanged

    End Sub
End Class